package com.hdy.net.retrofit;

import com.hdy.common.statistics.HdyStatistics;

import rx.Subscriber;

public class BaseSubscriber<T> extends Subscriber<T> {

    public BaseSubscriber() {
    }

    @Override
    public void onError(Throwable e) {
        if(e instanceof ExceptionHandle.ResponseThrowable){
            onError((ExceptionHandle.ResponseThrowable)e);
        } else {
            onError(new ExceptionHandle.ResponseThrowable(e, ExceptionHandle.ERROR.UNKNOWN));
        }
    }


    @Override
    public void onStart() {
        super.onStart();
    }

    @Override
    public void onCompleted() {
    }


    public void onError(ExceptionHandle.ResponseThrowable e) {
        HdyStatistics.getInstance().onError(e);
    }

    @Override
    public void onNext(T t) {
        if (t != null) {

        }
    }
}
